# Maintainer:
pkgname=prometheus-wireguard-exporter
pkgver=3.2.1
pkgrel=2
pkgdesc="A Prometheus exporter for WireGuard, written in Rust"
url="https://github.com/MindFlavor/prometheus_wireguard_exporter"
arch="all !s390x !ppc64le !mips !mips64" #Crypto is broken (https://github.com/briansmith/ring/issues/389)
license="MIT"
makedepends="cargo"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/MindFlavor/prometheus_wireguard_exporter/archive/$pkgver.tar.gz
	prometheus-wireguard-exporter.initd
	prometheus-wireguard-exporter.confd"

builddir="$srcdir"/prometheus_wireguard_exporter-"$pkgver"

build() {
	cargo build --release
}

check() {
	cargo test --release
}

package() {
	cargo install --path . --root="$pkgdir"/usr
	rm -f "$pkgdir"/usr/.crates2.json
	rm -f "$pkgdir"/usr/.crates.toml

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}
sha512sums="45de52b3bd30719407093fe562f44302dd34184b23ce63c1855ac6df064fd73dcac982aef3dfb03aa749fe9f207fa26f262583f76741081b8600d0298cda6101  prometheus-wireguard-exporter-3.2.1.tar.gz
f611bb81839735075f19e80155e9eb9e18da284ef2bada06eb6c5b9b06fc706a6b21d463f52027ba7dbe81b76e3f4771401265fe8a20d512082ec35358f091a3  prometheus-wireguard-exporter.initd
876f7f5a8c5092980783aa9f60eb7b3497d93ab66c1aa6780bf4988f720187d437c8b951f938f012956ed1ac1971eab85e972521750d1a25d41fc7fcf0357188  prometheus-wireguard-exporter.confd"
